package nullby.common.utils;

import android.app.AlertDialog.Builder;
import android.content.Context;
import android.widget.Toast;

/**
 * Provides application storage paths
 * 
 * @author Sergey Bandysik (bandysik[at]gmail[dot]com)
 */
public final class CustomToast {
	/**
	 * Display a simple alert dialog with the given text and title.
	 * 
	 * @param context
	 *            Android context in which the dialog should be displayed
	 * @param title
	 *            Alert dialog title
	 * @param text
	 *            Alert dialog message
	 */
	public final static void showAlert(final Context context,
			final String title, final String text) {
		Builder alertBuilder = new Builder(context);
		alertBuilder.setTitle(title);
		alertBuilder.setMessage(text);
		alertBuilder.create().show();
	}

	/**
	 * Display a simple toast with the given text and length show.
	 * 
	 * @param context
	 *            Android context in which the toast should be displayed
	 * @param text
	 *            Toast message
	 * @param duration
	 *            Toast length show
	 */
	public final static void showToast(final Context context,
			final String text, final int duration) {
		Toast.makeText(context, text, duration).show();
	}

	/**
	 * Display a simple long toast with the given text.
	 * 
	 * @param context
	 *            Android context in which the toast should be displayed
	 * @param text
	 *            Toast message
	 */
	public final static void showLongToast(final Context context,
			final String text) {
		showToast(context, text, Toast.LENGTH_LONG);
	}

	/**
	 * Display a simple short toast with the given text.
	 * 
	 * @param context
	 *            Android context in which the toast should be displayed
	 * @param text
	 *            Toast message
	 */
	public final static void showShortToast(final Context context,
			final String text) {
		showToast(context, text, Toast.LENGTH_SHORT);
	}
}
